package com.efuture.c3p0;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @ClassNAME C3P0GetConnection
 * @Description 演示c3p0的怎么获取一个连接对象
 * @Author zhaoshanshan
 * @Date 2021/9/20 7:59 下午
 * @Version 1.0
 */
public class C3P0BaseUse {

    public static void main(String[] args) {
        try{
            //获取连接池对象
            DataSource ds = new ComboPooledDataSource();
            //获取数据库连接对象
            Connection conn = ds.getConnection();
            System.out.println(conn);

        }catch (Exception e){
            e.printStackTrace();
        }

    }

}